import { 
  addListener, 
  addNavigationHelpers,
  StackNavigator,
  getNavigation,
  createBottomTabNavigator,
} from 'react-navigation';
import React, { Component } from 'react';
import { connect } from 'react-redux';

import Home from '../containers/Home';
import About from '../containers/About';

const StackNavigatorConfig = {

  // initialRouteName:'nativeView',//默认首页,若没有initialRouteName声明，则前面的页面排在第一个的就是首页
   onTransitionStart:()=>{
       console.log("导航栏切换开始");
   },
   onTransitionEnd:()=>{
       console.log("导航栏结束");
   },
  // mode:"card",//car:左右 modal:上下
};

export const AppNavigator = createBottomTabNavigator(  {
    Home: {
      screen: Home,
      navigationOptions:{
        headerTitle: 'Home'
      }
    },
    About:{
      screen: About,
      navigationOptions:{
        headerTitle: 'About'
      }
    }
  }
);
// alert(AppNavigator);
class NavContainer extends Component{
  render(){
      return (
        <AppNavigator />
      )
  }
}

const mapStateToProps = (state) => ({
  nav: state.navReducer
})

export default connect(mapStateToProps)(NavContainer);
